package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class DAO {
    static {
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();

        } catch (ClassNotFoundException ex) {
            Logger.getLogger(DAO.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
        } catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }

    public Connection getConnection(boolean autoCommit) throws SQLException {
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/urtmidias", "admin", "admin");
    	
        conn.setAutoCommit(autoCommit);
        return conn;
    }
}